# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
 -------------------------------------------------
    File Name:     env_manager.py
    Description:   环境检查模块：检查外部依赖（Redis、数据库、服务等）是否可用
 -------------------------------------------------
 """
import logging

from apitesting.common.db.redis_handler import redis_handler
# from apitesting.common.util.logger import log

# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)


def check_environment():
    """检查运行环境"""

    logger.debug(f"检查服务")

    try:
        logger.debug(f"检查服务 Redis 连接")
        redis_handler.check_connection()
        logger.info("✅ Redis 初始化成功")
    except Exception as e:
        logger.error(f"❌ Redis 初始化失败: {e}")

    logger.debug(f"环境检查通过")
